/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 74646
 * Date: 2022-02-11
 * Time: 20:18
 */
public class TestDemo {
    public static void main(String[] args) {

        String str1 = "Hello";
        String str2 = str1;
        str1 = "World";

        System.out.println(str2);
    }

    public static void main1(String[] args) {
        // 方式一：直接赋值
        String str = "Hello Bit";
        // 方式二：调用构造方法进行构造对象
        String str2 = new String("Hello Bit");
        // 方式三：使用数组
        char[] array = {'a', 'b', 'c'};
        String str3 = new String(array);
    }
}
